import { Column, Entity } from "typeorm";
import { BaseEntity } from "../../base/entity/base";
import { CommonStatus } from "../../../interface";

export enum MediaType {
  IMAGE = 'IMAGE',
  VIDEO = 'VIDEO',
  OTHER = 'OTHER',
}

@Entity('media_info', { comment: '媒体资源' })
export class MediaInfoEntity extends BaseEntity {
  @Column({ comment: '服务人员ID', nullable: false })
  providerId: number;

  @Column({ comment: '团队ID', nullable: true })
  teamId?: number;

  @Column({ comment: '媒体类型', type: 'enum', enum: MediaType, default: MediaType.IMAGE })
  type: MediaType;

  @Column({ comment: '资源地址', length: 500, nullable: false })
  url: string;

  @Column({ comment: '缩略图地址', length: 500, nullable: true })
  thumb?: string;

  @Column({ comment: '文件名', length: 255, nullable: true })
  name?: string;

  @Column({ comment: '文件大小(字节)', nullable: true })
  size?: number;

  @Column({ comment: '时长(毫秒)', nullable: true })
  duration?: number;

  @Column({ comment: '状态', type: 'enum', enum: CommonStatus, default: CommonStatus.NORMAL })
  status: CommonStatus;
}


